/* $RCSFile: LayoutItem.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/Design/LayoutItem.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:28  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Collections;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.IO;

namespace AddonNice.Design
{	
    /// <summary>
	/// LayoutItem encapsulates the items of Layout list.
	/// Uses IComparable interface to allow sorting by name.
	/// </summary>
	public class LayoutItem : IComparable 
	{
        private string _name                            =   string.Empty;
		private ItemOrigin _origin                      =   ItemOrigin.Public;

		/// <summary>
		/// The name of the layout
		/// </summary>
		public String Name 
		{
			get 
			{
				return _name;
			}
			set 
			{
				_name = value;
			}
		}
  
		public ItemOrigin Origin
		{
			get 
			{
				return _origin;
			}
			set 
			{
				_origin = value;
			}
		}
        public LayoutItem(string nm,ItemOrigin org)
        {
            _name       =   nm;
            _origin     =   org;
        }

        public int CompareTo(object value) 
		{
            if ( !( value is LayoutItem ) )
                return -1;

            if ( Origin == ((LayoutItem)value).Origin )
			    return Name.CompareTo(((LayoutItem)value).Name);
            else return ((int)Origin)-(int)((LayoutItem)value).Origin ;
		}
	}
}